<?php


// move this job to mysqldb, it may faster than mysql.


function test_insert(){
	$mongo = DbNosql::inst();	
	$collection= 	'agilet_templates';
	$data  = array(
		'_id'=> 'home',
		'is_system'=>1,
		'is_default'=>0,
		'uid'=>1,
		'updated'=> new MongoDate(time()),
		'params'=>array(),
		'areas'=>array(
			'content'=>array(
				array(
					'id'=>'testme0',
					'enabled'=>1,
					'spec'=>'block/content',
					'params'=>array('title'=>'what happen there','none-blocking'=>1),
				),
				array(
					'id'=>'testme1',
					'enabled'=>1,
					'type'=>'block',
					'spec'=>'block/ads/0',
					'params'=>array('title'=>'what happen there','none-blocking'=>1),
				),
				array(
					'id'=>'testme2',
					'enabled'=>1,
					'type'=>'block',
					'spec'=>'block/ads/2',
					'params'=>array('title'=>'what happen there','none-blocking'=>1),
				),
				array(
					'id'=>'testme3',
					'enabled'=>1,
					'type'=>'block',
					'spec'=>'block/ads/3',
					'params'=>array('title'=>'what happen there','none-blocking'=>1),
				),
				array(
					'id'=>'testme4',
					'enabled'=>1,
					'type'=>'block',
					'spec'=>'block/ads/3',
					'params'=>array('title'=>'what happen there','none-blocking'=>1),
				),
			),
		),
	);
	$mongo->save($collection, $data);
}

function test_find(){
	$mongo =  DbNosql::inst();
	$collection= 	'agilet_templates';
	$layout = $mongo->find_one($collection, array('_id'=>'home'));
	print_r($layout);
}

test_insert();
test_find();
